package cn.edu.scau.cmi.wuyihan.exercise4;

public class IsPerfectNumber {
      boolean judgeIsPerfectNumber(int number) {
    	  int factors[]=new int[number];
    	  int k=0;
    	  int sum=0;
    	  for(int i=1;i<number;i++) {
    		  if(number%i==0) {
    			  factors[k++]=i;
    		  }
    	  }
    	  for(int j=0;j<k;j++) {
    		  sum+=factors[j];
    	  }
    	  if(sum==number) {
    		  return true;
    	  }
    	  else {
    		  return false;
    	  }
      }
}
